var SceneEvent = function(options) {
	this.ctx = options.ctx;
	this.editor = options.editor;
	this.globe = options.editor.globe;
	this.sceneId=options.sceneId;
	this.tip=this.globe.createTip();
	this.init();
}

SceneEvent.prototype.init=function(){
	let _this=this;
	this.event=this.globe.createEvent();
	this.event.on('LEFT_CLICK',function(e){
		let obj=_this.globe.pick(e.position);
		if(Cesium.defined(obj)){
			if(_this.editor.sceneEditor.isState()){
				if(obj instanceof VFG.PModel){
					 _this.editor.sceneModelLibrary.editPModel(obj);
				}
				else if(obj instanceof VFG.VModel){
					_this.editor.sceneVideoFusion.editVModel(obj);
				}
				else if(obj instanceof VFG.ERoadMark){
					_this.editor.sceneRoadMark.edit(obj);
				} 
				else if(obj instanceof VFG.PPoint){
					_this.editor.scenePointLibrary.editPPoint(obj);
				} 
				else if(obj instanceof Cesium.Cesium3DTileFeature){
				}
				else if(obj instanceof VFG.EPolyline){
					_this.editor.scenePolylineLibrary.editEPolyline(obj);
				}
				_this.editor.scenePopup.close(obj.id);
			}
			else{
				//_this.editor.scenePopup.switch(obj);
			}
		}else{
			_this.close();
		}
		_this.editor.sceneMouseRM.close();
	});
	this.event.on('MOUSE_MOVE',function(e){
		if(!_this.editor.sceneEditor.isState()){
			let obj=_this.globe.pick(e.endPosition);
			if(Cesium.defined(obj)){
				if(_this.tip){
					_this.tip.setVisible(true);
					_this.tip.showAt(e.endPosition,obj.name);
				}
			}else{
				if(_this.tip){
					_this.tip.setVisible(false);
				}
			}
		}
	});
	this.event.on('RIGHT_CLICK',function(e){
		//_this.editor.sceneMouseRM.open(e);
	});
	this.event.on('LEFT_DOWN',function(e){
		//_this.editor.sceneMouseRM.close();
	});
}
SceneEvent.prototype.close=function(){
	let _this=this;
	if(_this.editor.sceneEditor.isState()) _this.editor.sceneModelLibrary.close();
	if(_this.editor.sceneEditor.isState()) _this.editor.sceneVideoFusion.close();
	if(_this.editor.sceneEditor.isState()) _this.editor.sceneRoadMark.close();
}

/**
 * 物
 */
SceneEvent.prototype.getThing=function(obj){
	let _this=this;
	return obj;
}




